package week02

// 162. 寻找峰值
// https://leetcode-cn.com/problems/find-peak-element/

func findPeakElement(nums []int) int {
	var left, right = 0, len(nums)-1
	for left < right {
		var mid = (right - left) / 2 + left
		if nums[mid] > nums[mid+1] {
			right = mid
		} else {
			left = mid + 1
		}
	}
	return right
}
